<dependency> <groupId>org.switchyard.components</groupId> <artifactId>switchyard-component-camel-file</artifactId> <version>SWITCHYARD-VERSION</version> </dependency>
The file binding in SwitchYard provides filesystem level support for services and references in SwitchYard.
The file binding is built on top of camel-file and supports most of options for this endpoint. Please refer camel documentation for detailed description of them.
This binding have it's own namespace. To use it you must declare namespace with uri urn:switchyard-component-camel-file:config:1.0. Your Maven project should also have following dependency:
<dependency> <groupId>org.switchyard.components</groupId> <artifactId>switchyard-component-camel-file</artifactId> <version>SWITCHYARD-VERSION</version> </dependency>
Following options can be apiled to <binding.file> definition:
directory : directory to consume/produce files to
autoCreate : automatically create directory if doesn't exist
bufferSize : write buffer size
fileName : file name filter for consumer or file name pattern for producer
flatten : skip path and just use file name
charset : charset used for reading/wrinting file
Supported options are:
delete
recursive
noop
preMove
move
moveFailed
include
exclude
idempotent
idempotentRepository
inProgressRepository
filter
sorter
sortBy
readLock
readLockTimeout
readLockCheckInterval
exclusiveReadLockStrategy
processStrategy
startingDirectoryMustExist
directoryMustExist
doneFileName
Here's an example of what a file service binding looks like:
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0"> <sca:service name="GreetingService" promote="GreetingService"> <camel:binding.file> <camel:directory>target/input</camel:directory> <camel:fileName>test.txt</camel:fileName> <camel:consume> <camel:initialDelay>50</camel:initialDelay> <camel:delete>true</camel:delete> </camel:consume> </camel:binding.file> </sca:service> </sca:composite>
Binding a reference with file can be used to store outcome of service on disk. The following configuration options are available for binding.file when binding references:
fileExist
tempPrefix
tempFileName
keepLastModified
eagerDeleteTargetFile
doneFileName
For detailed description of these parameters please refer camel-file documentation
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0"> <sca:reference name="GreetingService" promote="camel-binding/GreetingService" multiplicity="1..1"> <camel:binding.file> <camel:directory>target/output</camel:directory> <camel:autoCreate>false</camel:autoCreate> <camel:produce> <camel:fileExist>Override</camel:fileExist> </camel:produce> <camel:binding.file> </sca:reference> </sca:composite>